from collections.abc import Iterator


class Company:
    def __init__(self, employee_list):
        self.employee = employee_list

    # def __getitem__(self, item):
    #     return self.employee[item]

    def __iter__(self):
        return MyIterator(self.employee)


class MyIterator(Iterator):
    def __init__(self, iter_list):
        self.iter_list = iter_list
        self.index = 0

    def __next__(self):
        try:
            word = self.iter_list[self.index]
        except IndexError:
            raise StopIteration

        self.index += 1
        return word


if __name__ == '__main__':
    com = Company(["tom", "leo", "joe"])
    my_iter = iter(com)
    # for item in com:
    #     print(item)
    while True:
        try:
            print(next(my_iter))
        except StopIteration:
            pass